-
Notifications
You must be signed in to change notification settings - Fork 29
Removes default dependency to Zend\StdLib #21
Removes default dependency to Zend\StdLib #21
Conversation
/** | ||
* Setup autoloading | ||
*/ | ||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
/** | ||
* Setting the Zend\StdLib/ErrorHandler as default ErrorHandler | ||
*/ | ||
Zend\Ldap\ErrorHandler::setErrorHandler(new ZendTest\Ldap\ErrorHandler()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the default ErrorHandler does nothing at all but the tests seem to depend on error-suppression I've added that one to get the tests running under the same conditions as before. I was thinking of adding that line to src/Ldap.php (at the very end) so that that's set as default error handler and users can overwrite that with their own implementation. On the other hand that would mean that the dependency to Zend\StdLib\ErrorHandler
would not be eliminated.
Looks nice! |
}, | ||
"require-dev": { | ||
"zendframework/zend-config": "~2.5", | ||
"zendframework/zend-eventmanager": "~2.5", | ||
"fabpot/php-cs-fixer": "1.7.*", | ||
"phpunit/PHPUnit": "~4.0" | ||
"phpunit/PHPUnit": "~5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use "phpunit/phpunit": "~4.0|~5.0"
then the dependency of php >=5.6 will use phpunit 5, and for php 5.5 will still uses phpunit 4
👍 |
This commit removes the default dependency to the ```\Zend\StdLib\ErrorHandler``` by replacing it with a ```\Zend\Ldap\ErrorHandler``` that delegates the error handling to an injectable ErrorHandler. That way the tests can use ```\Zend\StdLib\ErrorHandler``` and silence errors during the tests whereas in a live environment no error-suppression is used by default. Other ErrorHandlers can be used by creating a class that implements ```\Zend\Ldap\ErrorHandlerInterface``` and injecting an instance of that class as ErrorHandler using ```\Zend\Ldap\ErrorHandler::setErrorHandler()```
This commit adds some space and newlines
b6829cb
to
81bf78b
Compare
This commit removes the default dependency to the
\Zend\StdLib\ErrorHandler
by replacing it with a\Zend\Ldap\ErrorHandler
that delegates the error handling to an injectable ErrorHandler.That way the tests can use
\Zend\StdLib\ErrorHandler
and silence errors during the tests whereas in a live environment no error-suppression is used by default.Other ErrorHandlers can be used by creating a class that implements
\Zend\Ldap\ErrorHandlerInterface
and injecting an instance of that class as ErrorHandler using\Zend\Ldap\ErrorHandler::setErrorHandler()
The main aim would be to get rid of external dependencies to make the component as independent as possible and allow a more widespread usage.
This has been influenced by zendframework/zendframework#7497 and symfony/symfony-docs#5756